#ifndef _KLAS_TEXTURE_HPP_
#define _KLAS_TEXTURE_HPP_

#include "../include/Defines.hpp"
#include "../include/Libs.hpp"
#include "../include/Vector2.hpp"
#include "../include/Data.hpp"
#include <string>
using namespace std;

namespace klas
{
  class Data;

	//! A texture is an image that klas can apply to a primitive.
  class Texture : public DataObject
	{
		public:
			
			//! Ctor.
			Texture();
			
			//! Ctor.
			/*! \param file The file to load the texture from */
			Texture(string file);
			
			//! Dtor.
			~Texture();
			
			//! Deletes the texture.
      virtual bool kill();
			
			//! Is the Texture valid?
			/*! \return True if the texture can be used. */
      virtual bool isValid() const;
			
      //! Gets the type of object this is.
      /*! \return Node::TEXTURE */
      virtual iReal getObjectType() const;

			//! Gets the disply list ID.
			/*! \return The ID of the display list.  INVALID_ID on error. */
			GLuint getDisplayListID() const;

      //! Gets the display list ID that renders the point sprite.
      /*! \return The ID of the display list that renders the point sprite.  INVALID_ID on error. */
      GLuint getPointSpriteDisplayListID() const;

      //! Gets the texture ID
      /*! \return The ID of the texture. INVALID_ID on error. */
      GLuint getTextureID() const;

			//! Gets the original dimensions of the texture.
			/*! \return The original dimensions of the texture. */
			Vector2<iReal> getOrigDim() const;
			
			//! Gets the padded dimensions of the texture.
			/*! \return The padded dimensions of the texture. */
			Vector2<iReal> getPaddedDim() const;
					
			//! Loads a file
			/*! \param file The path of the image to load.
					\return If loading the image was successful. */
			bool load(string file);
			
		private:
			
			//! The ID of the display list.
      GLuint m_displayID,

      //! The ID of the display list for the point sprite
             m_pointSpriteDisplayID,
						 
			//! The ID of the OpenGL texture.
						 m_textureID;
						
			//! The original dimensions of the texture.
			Vector2<iReal> m_origDim,
			
			//! The original dimensions of the texture, but to the next power of two.
							m_paddedDim;
	};
}

#endif
